<template>
  <div>
    <HelloWorld :data="courseData" v-bind:num="course" ref="msg" @getMsg="getMsgs">dasdadasd</HelloWorld>
    <p ref="dom"></p>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'

export default {
  name: 'App',
  components: {
    HelloWorld
  },
  data() {
    return {
      course: 23,
      courseData: {
        courseName: "Mathematics",
        instructor: "张老师",
        level: "Intermediate",
        duration: 300,
        enrolledStudents: 5000
      }
    }
  },
  mounted() {
    //父传子 props，$refs
    this.$refs.msg.getmsg('aaa')
    // 本页面传值
    this.$refs.dom.innerHTML = 'bbb'
    console.log(this.$refs);
    //   // params传值
    //   this.$router.push({name:'跳转路径',params:{id:item.id}})
    //   this.$route.params.id
    // //  路由属性传值
    // this.$router.push({name:'index/${item.id}'})
    // // query传值？后面(解决页面刷新数据丢失问题)
    // this.$router.push({
    //   name:'跳转路径',
    //   query:{id:item.id}  
    // })
  },
  methods: {
    getMsgs(a) {
      console.log(a);
    }
  }

}

</script>


